//
//  StudentPackage.m
//  Classes & Objects
//
//  Created by admin on 2019/8/1.
//  Copyright © 2019 猫爷爷的酱醋茶. All rights reserved.
//

#import "StudentPackage.h"

@implementation Student
-(void)setName:(NSString*)name
{
    if([name length] < 2 || [name isEqualToString:@"伟人"])
   {
       _name = @"佚名";
       return;
   }
    
    _name = name;

}
-(NSString *)name
{
    return _name;
}

-(void)setAge:(int)age
{
    _age = age >= 0 && age <= 200 ? age : 18;
}
-(int)age
{
    return _age;
}

-(void)setChineseScore:(float)ChineseScore
{
    _ChineseScore = ChineseScore >= 0 && ChineseScore <= 150 ? ChineseScore : 0;
}
-(float)ChineseScore
{
    return _ChineseScore;
}

-(void)setEnglishScore:(float)EnglishScore
{
    _EnglishScore = EnglishScore >= 0 && EnglishScore <= 150 ? EnglishScore : 0;
}
-(float)EnglishScore
{
    return _EnglishScore;
}

-(void)setMathScore:(float)MathScore
{
    _MathScore = MathScore >= 0 && MathScore <= 150 ? MathScore : 0;
}
-(float)Mathscore
{
    return _MathScore;
}

-(void)SayHi
{
    NSLog(@"同学们好，我是%@，我今年%d岁，我的总成绩是%.2f，我的平均成绩是%.2f，谢谢大家",
          _name,_age,_ChineseScore + _MathScore + _EnglishScore,(_ChineseScore + _MathScore + _EnglishScore)/3
          );
    
}

@end
